package com.marveal.rabbit.producer.config.database;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import javax.sql.DataSource;

@Setter
@Getter
@Configuration
@PropertySource(value = {"classpath:/rabbit-producer-message.yml"})
@ConfigurationProperties(prefix = "rabbit.producer.datasource")
public class RabbitProducerDataSourceProperties {
    @Value("${type}")
    private Class<? extends DataSource> dataSourceType;

    @Value("${url}")
    private String url;

    @Value("${user}")
    private String username;

    @Value("${password}")
    private String password;

    @Value("${driver-class-name}")
    private String driverClassName;

    @Value("${pool-name}")
    private String poolName;

    @Value("${minimum-idle}")
    private int minimumIdle;

    @Value("${connection-timeout}")
    private long connectionTimeout;

    @Value("${idle-timeout}")
    private long idleTimeout;

    @Value("${max-lifetime}")
    private long maxLifetime;

    @Value("${auto-commit}")
    private boolean autoCommit;

    @Value("${connection-test-query}")
    private String connectionTestQuery;
}
